package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.ShopFreightArea;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 运费模板配送区域 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-08-27
 */
public interface ShopFreightAreaMapper extends BaseAddMapper<ShopFreightArea> {


    @Insert("<script>" +
            "insert into shop_freight_area(" +
            "shop_freight_id," +
            "first_unit," +
            "first_unit_cost," +
            "accumulation_unit," +
            "accumulation_unit_cost," +
            "city_id," +
            "is_deleted," +
            "gmt_create," +
            "gmt_modified" +
            ") values" +
            "<foreach collection='list' item='item'  separator=','>" +
            "(" +
            "#{item.shopFreightId}," +
            "#{item.firstUnit}," +
            "#{item.firstUnitCost}," +
            "#{item.accumulationUnit}," +
            "#{item.accumulationUnitCost}," +
            "#{item.cityId}," +
            "#{item.isDeleted}," +
            "now()," +
            "now()" +
            ")" +
            "</foreach>" +
            "</script>")
    void insertList(@Param("list") List<ShopFreightArea> list);
}
